package com.example.day5.controller;

import jakarta.servlet.http.HttpServletRequest;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;

@Controller
public class ThymeleafController {
    @GetMapping("/thymeleaf")
    public String hello(HttpServletRequest request, @RequestParam(value="description",defaultValue = "hello thymeleaf") String description){
         request.setAttribute("description",description);
        return "thymeleaf";
    }
    @GetMapping("simple")
    public String simple(ModelMap map){
       map.put("thymeleafText","spring-boot");
       map.put("number1",2021);
       map.put("number2",2);
       return "simple";
    }
}
